// AMap.js
// 高德map   https://webapi.amap.com/maps?v=1.4.11&key=你的高德地图的key
export default function MapLoader () {
	return new Promise((resolve, reject) => {
		window._AMapSecurityConfig = {
			securityJsCode: '2d6d6882188f118ed1669027b6103b5e'
		}
		if (window.AMap) {
			resolve(window.AMap)
		} else {
			var script = document.createElement('script')
			script.type = 'text/javascript'
			script.async = true
			script.src = 'https://webapi.amap.com/maps?v=1.4.11&callback=initAMap&key=d2b1465f354c6583e5b3a781365dce8d'
			script.onerror = reject
			document.head.appendChild(script)
		}
		window.initAMap = () => {
			resolve(window.AMap)
		}
	})
}